Games can have achievements with no completion value and so you can use this function to increment those achievement by a given amount. On Android, you send the ID of the achievement as a string (this is the unique achievement ID that got assigned when you set up the achievement), while on all other platforms you supply the defined achievement name as a string, and then you give the actual achievement value to increment by.
The function will trigger a Social Asynchronous Event where the returned async_load DS map will have the following key/value pairs:
- "type" - This is the type of event that has been fired, which will be the string "achievement_increment_result" for this function.
- "id" - This is the ID of the event, and, for this function, it will return a GML constant GooglePlayServices_EVENT_ID_INCREMENT_ACHIEVEMENT.
- "achievement_id" - This is the unique ID of achievement that has been incremented.
- "status" - This will be 1 if the achievement was incremented successfully, or 0 if the request failed
- "complete" - This will be 1 if the achievement has been completed by this increment, or 0 if the request failed
achievement_increment(name, value)
Argument | Description |
---|---|
name | The name/id of the achievement. |
value | The value to be sent as an increment. |
N/A
achievement_increment(global.Achievement[0], score);
The above code adds the current player score to the achievement with the ID stored in the global array.